package com.example.demo.common;

import lombok.Data;

import java.util.Date;
import java.util.UUID;



@Data
public abstract class BaseEntityImp implements BaseEntity {

    protected String uuid;
    protected Date createdAt;
    protected Date updatedAt;
    protected String createdBy;
    protected String updatedBy;

    public void BaseEntityImp() {
        this.uuid = UUID.randomUUID().toString();
        this.createdAt = new Date();
        this.updatedAt = this.createdAt;
        // 你可以在这里设置默认的createdBy和updatedBy
        this.createdBy = "system";
        this.updatedBy = "system";
    }

    @Override
    public String getUuid() {
        return uuid;
    }

    @Override
    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    @Override
    public Date getCreatedAt() {
        return createdAt;
    }

    @Override
    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    @Override
    public Date getUpdatedAt() {
        return updatedAt;
    }

    @Override
    public void setUpdatedAt(Date updatedAt) {
        this.updatedAt = updatedAt;
    }

    @Override
    public String getCreatedBy() {
        return createdBy;
    }

    @Override
    public void setCreatedBy(String createdBy) {
        this.createdBy = createdBy;
    }

    @Override
    public String getUpdatedBy() {
        return updatedBy;
    }

    @Override
    public void setUpdatedBy(String updatedBy) {
        this.updatedBy = updatedBy;
    }
}
